<?php echo $this->completion(); ?>
<div class="usvn_info">
	<h1><?php echo $this->project->name;?></h1>
	<p><?php echo $this->project->description;?><br /><br />
<?php echo sprintf(T_("Checkout URL : %s"), Zend_Registry::get('config')->subversion->url . $this->project->name . "/trunk/"); ?>
</p>
</div>
<div class="usvn_info">
	<?php if ($this->isAdmin) : ?>
		<form style="float: right; text-align: right;" action="<?php echo $this->url(array("action" => "adduser")); ?>" method="post">
			<div>
				<table>
					<tr>
						<td>
							<?php echo $this->formText("users_login", null, array("onkeyup" => "javascript:ajax_completion(1, 'completion', 'users_login', event)", "autocomplete" => "off", "onkeyDown" => "javascript:geretouche(event, 'completion', 'users_login')")); ?>
						</td>
						<td>
							<?php echo $this->formSubmit("adduser", T_("Add")); ?>
						</td>
					</tr>
					<tr>
						<td>
							<div id="completion" class="_list_autocomplete_ajax" style="visibility:hidden"></div>
						</td>
						<td>
						</td>
					</tr>
				</table>
			</div>
		</form>
	<?php endif; ?>

	<h1><?php echo T_("Admins users");?></h1>
	<ul>
		<?php foreach ($this->project->findManyToManyRowset("USVN_Db_Table_Users", "USVN_Db_Table_UsersToProjects") as $user) :?>
			<li>
				<?php if ($this->isAdmin) : ?>
					<?php echo $this->urlConfirm(array("action" => "deleteuser", "users_id" => $user->id), $this->img("/CrystalClear/16x16/actions/editdelete.png", T_("Delete")),
					sprintf(T_("Do you really want to remove user %s as admin of project %s?"), $user->login, $this->project->name));
					?>
				<?php endif; ?>
				&nbsp;<?php echo $user->login; ?>
			</li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="usvn_info">
	<?php if ($this->isAdmin) : ?>
		<form style="float: right; text-align: right;" action="<?php echo $this->url(array("action" => "addgroup")); ?>" method="post">
			<div>
				<table>
					<tr><td>
						<?php echo $this->formText("groups_name", null, array("onkeyup" => "javascript:ajax_completion(2, 'completion1', 'groups_name', event)", "autocomplete" => "off", "onkeyDown" => "javascript:geretouche(event, 'completion1', 'groups_name')")); ?>
					</td><td>
						<?php echo $this->formSubmit("addgroup", T_("Add")); ?>
					</td></tr>
					<tr><td><div id="completion1" class="_list_autocomplete_ajax" style="visibility:hidden"></div></td><td></td></tr>
				</table>
			</div>
		</form>
	<?php endif; ?>

	<h1><?php echo T_("Affected groups");?></h1>
	<ul>
		<?php foreach ($this->project->findManyToManyRowset("USVN_Db_Table_Groups", "USVN_Db_Table_GroupsToProjects") as $group) :?>
			<li>
				<?php if ($this->isAdmin) : ?>
					<?php echo $this->urlConfirm(array("action" => "deletegroup", "groups_id" => $group->id), $this->img("/CrystalClear/16x16/actions/editdelete.png", T_("Delete")),
					sprintf(T_("Do you really want to remove group %s from project %s?"), $group->name, $this->project->name));
					 ?>
					&nbsp;<a href="<?php echo $this->url(array("action" => "managegroup", "name" => $group->name)); ?>">
						<?php echo $this->img("/CrystalClear/16x16/actions/edit.png", T_("Manage")); ?>
					</a>
				<?php endif; ?>
				&nbsp;<?php echo $group->name; ?></li>
		<?php endforeach; ?>
	</ul>
</div>
<div class="usvn_info">
	<h1><?php echo T_("Last five commit") ?></h1>
	<table id="commits" class="sortable">
		<thead>
			<tr>
				<th><?php echo T_("Revision");?></th>
				<th><?php echo T_("Author");?></th>
				<th><?php echo T_("Date");?></th>
				<th><?php echo T_("Message");?></th>
			</tr>
		</thead>
		<tbody>
		<?php
			foreach (array_keys($this->log) as $revision) {
				$commit = $this->log[$revision];
				echo "<tr><td>{$revision}</td><td>{$commit['author']}</td><td>" . date("Y-m-d",  $commit["date"]) . "&nbsp;" . date("H:i", $commit["date"]) . "</td><td>" . nl2br($commit['msg']) . "</td></tr>";
			}
		?>
		</tbody>
	</table>
</div>
